﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title id="Description">Data Binding to XML data with values stored in attributes</title>
    <meta name="description" content="This sample demonstrates how we can bind jQWidgets DataTable widget to XML Data with attributes by using jQWidgets DataAdapter plugin.">
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdatatable.js"></script>
    <script type="text/javascript" src="../../scripts/demos.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var source =
            {
                dataType: 'xml',
                url: '../sampledata/xmlattributes.xml',
                datafields: [
                    { name: 'firstName', map: '[firstName]', type: 'string' },
                    { name: 'lastName', map: '[lastName]', type: 'string' },
                    { name: 'title', map: '[title]', type: 'string' }
                ],
                root: 'Table',
                record: 'Record'
            }

            var dataAdapter = new $.jqx.dataAdapter(source);

            // Create jqxGrid
            $("#dataTable").jqxDataTable(
            {
                width: 850,
                source: dataAdapter,
                columnsResize: true,
                columns: [
                      { text: 'First Name', dataField: 'firstName', width: 250 },
                      { text: 'Last Name', dataField: 'lastName', width: 250 },
                      { text: 'Title', dataField: 'title' }
                ]
            });
        });
    </script>
</head>
<body class='default'>
    <div id="dataTable"></div>
</body>
</html>
